package com.xzy.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.xzy.entities.UserEntity;
import com.xzy.msg.MessageBox;
import com.xzy.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 支付
 *
 * @author xzy
 * @date 2022/1/7 16:10
 */
@RestController
@RequestMapping(path = "/payment")
public class PaymentController {
    @Reference //从注册中心获取服务
    private UserService userService;

    /**
     * 获取用户信息
     *
     * @param userId 用户ID
     * @return 用户信息
     */
    @GetMapping("/userInfo")
    public MessageBox<UserEntity> findUserInfo(@RequestParam Long userId) {
        return MessageBox.ok(userService.findByPrimaryKey(userId));
    }
}
